﻿<Page x:Class="WpfPostgresql.PosilkaPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="300"
      
	Title="PosilkaPage" Loaded="PageLoaded">

    <Grid>
        <StackPanel>
            <StackPanel Orientation="Horizontal">
                <Button Click="ButtonClick" Content="Отправить" Command="{Binding SendCommand}" />
                <ComboBox Width="100"  ItemsSource="{Binding Magazins}" SelectedItem="{Binding SelectedMagaz, Mode=TwoWay}">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Name}"/>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
                <ComboBox Width="100" ItemsSource="{Binding Voditels}" SelectedItem="{Binding SelectedVoditel, Mode=TwoWay}">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Name}"/>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <ComboBox Text="Товар" Width="150" ItemsSource="{Binding Tovars}" SelectedItem="{Binding SelectedTovar, Mode=TwoWay}">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Width="100" Text="{Binding Name}"/>
                                <TextBlock Width="50" Text="{Binding N}"/>
                            </StackPanel>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
                <Button Content="+" Width="30" Command="{Binding AddCommand}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Везёт: "/>
                <TextBlock Width="150" Text="{Binding SelectedVoditel.Name}"/>
                <TextBlock Text=" Кому: "/>
                <TextBlock Width="150" Text="{Binding SelectedMagaz.Addres}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Width="100" Text="Название "/>
                        <TextBlock Text="Количество"/>
                    </StackPanel>
                </StackPanel>
            </StackPanel>
            <ScrollViewer Height="150">
                <ListBox ItemsSource="{Binding TovarsTemp}">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <Border BorderBrush="Black" SnapsToDevicePixels="True" BorderThickness="1">
                                    <TextBlock Width="100" Text="{Binding Name}"/>
                                </Border>
                                <Border BorderBrush="Black" SnapsToDevicePixels="True" BorderThickness="1">
                                    <TextBlock Width="50" Text="{Binding N}"/>
                                </Border>
                                <Button Content="x" Width="25" Command="{Binding ParentVm.DelCommand}" CommandParameter="{Binding}"  />
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </ScrollViewer>

        </StackPanel>
    </Grid>
</Page>
